# U2
file(GLOB_RECURSE SOURCES
        "Src/*.c"
        )

file(GLOB_RECURSE HEADERS
        "Inc/*.h"
        )

add_link_options(-static)

# U2
add_executable(smartDoor.elf ${SOURCES} ${HEADERS})

target_include_directories(smartDoor.elf PRIVATE Inc)

# target_link_libraries(smartDoor.elf U2Library)

set(HEX_FILE ${PROJECT_BINARY_DIR}/Door.hex)
set(BIN_FILE ${PROJECT_BINARY_DIR}/Door.bin)

add_custom_command(TARGET smartDoor.elf POST_BUILD
        COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:smartDoor.elf> ${HEX_FILE}
        COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:smartDoor.elf> ${BIN_FILE}
        COMMENT "Building ${HEX_FILE} Building ${BIN_FILE}")